using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using WebControls;
using InfraStructureLayer;
using BusinessLayer;

public partial class UserControls_uctPhotos : SFUserControl
{
    protected bool sfrPhotos_NeedsDataSource()
    {
        busPhotos insBusPhotos = new busPhotos();
        DataTable insDataTablePhotos = insBusPhotos.SelectPhotosRandom();
        if (insBusPhotos.HasErrors)
        {
            MessageBoxShow(insBusPhotos);
            return true;
        }

        sfrPhotos.SetData(insDataTablePhotos);
        return insBusPhotos.HasErrors;
    }
    protected void ibtRss_Click(object sender, ImageClickEventArgs e)
    {
        Response.Redirect("~/" + CurrentContext.Language + "/Rss/RssPhotos.ashx");
    }
    protected void lbtShowAll_Click(object sender, EventArgs e)
    {
        Response.Redirect("~/" + CurrentContext.Language + "/Photos/default.aspx");
    }
    protected string GeneratePhotoUrl(object obj)
    {
        //if(obj.ToString().StartsWith(CurrentContext.Parameters["WebSiteAddress"])
        Crypto c = new Crypto();
        return "~/Handlers/Image.ashx?Url=" + c.EncryptURL(obj.ToString()) + "&Width=180";
    }
}
